Rules for integrands of the form ((Trig[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)

1.  ∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx

1.  ∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0

1:  ∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ p∈ℤ, then

∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[(a_+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

Int[(a_+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

2:  ∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^p)/(((b+2 c F[x]))^(2p)))==0

Rule: If  (b^2)-4a c==0 ∧ p∉ℤ, then

∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)/(((b+2 c ((Tan[d+e x])^n)))^(2p)))∫(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[(a_+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Tan[d+e*x]^n+c*Tan[d+e*x]^(2*n))^p/(b+2*c*Tan[d+e*x]^n)^(2*p)*Int[(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

Int[(a_+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Cot[d+e*x]^n+c*Cot[d+e*x]^(2*n))^p/(b+2*c*Cot[d+e*x]^n)^(2*p)*Int[(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

2.  ∫(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0

1:  ∫(1/(a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))dx  when  (b^2)-4 a c≠0

Derivation: Algebraic expansion

Basis: If  q=(Sqrt[(b^2)-4 a c]), then (1/(a+b z+c (z^2)))==((2 c)/(q(b-q+2 c z)))-((2 c)/(q(b+q+2 c z)))

Rule: If  (b^2)-4 a c≠0, let  q=(Sqrt[(b^2)-4 a c]), then

∫(1/(a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))dx  ⟶  ((2 c)/q)∫(1/(b-q+2 c ((Tan[d+e x])^n)))dx-((2 c)/q)∫(1/(b+q+2 c ((Tan[d+e x])^n)))dx

Program code:

Int[1/(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Tan[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Tan[d+e*x]^n),x]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

Int[1/(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  2*c/q*Int[1/(b-q+2*c*Cot[d+e*x]^n),x] - 
  2*c/q*Int[1/(b+q+2*c*Cot[d+e*x]^n),x]] /;
FreeQ[{a,b,c,d,e,n},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

2.  ∫((Sin[d+e x])^m) (((a+b (((f Tan[d+e x]))^n)+c (((f Tan[d+e x]))^(2n))))^p)dx

1:  ∫((Sin[d+e x])^m) (((a+b (((f Tan[d+e x]))^n)+c (((f Tan[d+e x]))^(2n))))^p)dx  when  (m/2)∈ℤ

Derivation: Integration by substitution

Basis: ((Sin[z])^2)==(((Tan[z])^2)/(1+((Tan[z])^2)))

Basis: If (m/2)∈ℤ, then ((Sin[d+e x])^m)F[f Tan[d+e x]]==(f/e)Subst[(((x^m)F[x])/((((f^2)+(x^2)))^((m/2)+1))),x,f Tan[d+e x]](∂_x)(f Tan[d+e x])

Rule: If (m/2)∈ℤ, then

∫((Sin[d+e x])^m) (((a+b (((f Tan[d+e x]))^n)+c (((f Tan[d+e x]))^(2n))))^p)dx  ⟶  (f/e)Subst[∫(((x^m)(((a+b (x^n)+c (x^(2n))))^p))/((((f^2)+(x^2)))^((m/2)+1)))dx,x,f Tan[d+e x]]

Program code:

Int[sin[d_.+e_.*x_]^m_*(a_.+b_.*(f_.*tan[d_.+e_.*x_])^n_.+c_.*(f_.*tan[d_.+e_.*x_])^n2_.)^p_,x_Symbol] :=
  f/e*Subst[Int[x^m*(a+b*x^n+c*x^(2*n))^p/(f^2+x^2)^(m/2+1),x],x,f*Tan[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,n,p},x] && EqQ[n2,2*n] && IntegerQ[m/2]

Int[cos[d_.+e_.*x_]^m_*(a_.+b_.*(f_.*cot[d_.+e_.*x_])^n_.+c_.*(f_.*cot[d_.+e_.*x_])^n2_.)^p_,x_Symbol] :=
  -f/e*Subst[Int[x^m*(a+b*x^n+c*x^(2*n))^p/(f^2+x^2)^(m/2+1),x],x,f*Cot[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,n,p},x] && EqQ[n2,2*n] && IntegerQ[m/2]

2:  ∫((Sin[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ ∧ p∈ℤ

Derivation: Integration by substitution

Basis: ((Tan[z])^2)==((1-((Cos[z])^2))/((Cos[z])^2))

Basis: If ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ, then ((Sin[d+e x])^m)F[((Tan[d+e x])^n)]==-(1/d)Subst[(((1-(x^2)))^((m-1)/2))F[((((1-(x^2)))^(n/2))/(x^n))],x,Cos[d+e x]](∂_x)Cos[d+e x]

Rule: If ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ ∧ p∈ℤ, then

∫((Sin[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  -(1/d)Subst[∫(((((1-(x^2)))^((m-1)/2)) (((a (x^(2n))+b (x^n)(((1-(x^2)))^(n/2))+c (((1-(x^2)))^n)))^p))/(x^(2n p)))dx,x,Cos[d+e x]]

Program code:

Int[sin[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Cos[d+e*x],x]},
  -g/e*Subst[Int[(1-g^2*x^2)^((m-1)/2)*ExpandToSum[a*(g*x)^(2*n)+b*(g*x)^n*(1-g^2*x^2)^(n/2)+c*(1-g^2*x^2)^n,x]^p/(g*x)^(2*n*p),x],x,Cos[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n/2] && IntegerQ[p]

Int[cos[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Sin[d+e*x],x]},
  g/e*Subst[Int[(1-g^2*x^2)^((m-1)/2)*ExpandToSum[a*(g*x)^(2*n)+b*(g*x)^n*(1-g^2*x^2)^(n/2)+c*(1-g^2*x^2)^n,x]^p/(g*x)^(2*n*p),x],x,Sin[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n/2] && IntegerQ[p]

3.  ∫((Cos[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx

1:  ∫((Cos[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (m/2)∈ℤ

Derivation: Integration by substitution

Basis: ((Cos[z])^2)==(1/(1+((Tan[z])^2)))

Basis: If (m/2)∈ℤ, then ((Cos[d+e x])^m)F[f Tan[d+e x]]==((f^(m+1))/e)Subst[((F[x])/((((f^2)+(x^2)))^((m/2)+1))),x,f Tan[d+e x]](∂_x)(f Tan[d+e x])

Rule: If (m/2)∈ℤ, then

∫((Cos[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  ((f^(m+1))/e)Subst[∫((((a+b (x^n)+c (x^(2n))))^p)/((((f^2)+(x^2)))^((m/2)+1)))dx,x,f Tan[d+e x]]

Program code:

Int[cos[d_.+e_.*x_]^m_*(a_.+b_.*(f_.*tan[d_.+e_.*x_])^n_.+c_.*(f_.*tan[d_.+e_.*x_])^n2_.)^p_.,x_Symbol] :=
  f^(m+1)/e*Subst[Int[(a+b*x^n+c*x^(2*n))^p/(f^2+x^2)^(m/2+1),x],x,f*Tan[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,n,p},x] && EqQ[n2,2*n] && IntegerQ[m/2]

Int[sin[d_.+e_.*x_]^m_*(a_.+b_.*(f_.*cot[d_.+e_.*x_])^n_.+c_.*(f_.*cot[d_.+e_.*x_])^n2_.)^p_.,x_Symbol] :=
  -f^(m+1)/e*Subst[Int[(a+b*x^n+c*x^(2*n))^p/(f^2+x^2)^(m/2+1),x],x,f*Cot[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,n,p},x] && EqQ[n2,2*n] && IntegerQ[m/2]

2:  ∫((Cos[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ ∧ p∈ℤ

Derivation: Integration by substitution

Basis: ((Tan[z])^2)==(((Sin[z])^2)/(1-((Sin[z])^2)))

Basis: If ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ, then ((Cos[d+e x])^m)F[((Tan[d+e x])^n)]==(1/e)Subst[(((1-(x^2)))^((m-1)/2))F[((x^n)/(((1-(x^2)))^(n/2)))],x,Sin[d+e x]](∂_x)Sin[d+e x]

Rule: If ((m-1)/2)∈ℤ ∧ (n/2)∈ℤ ∧ p∈ℤ, then

∫((Cos[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  (1/e)Subst[∫(((1-(x^2)))^((m-2n p-1)/2))(((c (x^(2 n))+b (x^n) (((1-(x^2)))^(n/2))+a (((1-(x^2)))^n)))^p)dx,x,Sin[d+e x]]

Program code:

Int[cos[d_.+e_.*x_]^m_*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Sin[d+e*x],x]},
  g/e*Subst[Int[(1-g^2*x^2)^((m-2*n*p-1)/2)*ExpandToSum[c*x^(2*n)+b*x^n*(1-x^2)^(n/2)+a*(1-x^2)^n,x]^p,x],x,Sin[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n/2] && IntegerQ[p]

Int[sin[d_.+e_.*x_]^m_*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Cos[d+e*x],x]},
  -g/e*Subst[Int[(1-g^2*x^2)^((m-2*n*p-1)/2)*ExpandToSum[c*x^(2*n)+b*x^n*(1-x^2)^(n/2)+a*(1-x^2)^n,x]^p,x],x,Cos[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e},x] && EqQ[n2,2*n] && IntegerQ[(m-1)/2] && IntegerQ[n/2] && IntegerQ[p]

4.  ∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx

1.  ∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0

1:  ∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ p∈ℤ, then

∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫((Tan[d+e x])^m)(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Tan[d+e*x]^m*(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  1/(4^p*c^p)*Int[Cot[d+e*x]^m*(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

2:  ∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^p)/(((b+2 c F[x]))^(2p)))==0

Rule: If  (b^2)-4a c==0 ∧ p∉ℤ, then

∫((Tan[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)/(((b+2 c ((Tan[d+e x])^n)))^(2p)))∫((Tan[d+e x])^m)(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Tan[d+e*x]^n+c*Tan[d+e*x]^(2*n))^p/(b+2*c*Tan[d+e*x]^n)^(2*p)*Int[Tan[d+e*x]^m*(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Cot[d+e*x]^n+c*Cot[d+e*x]^(2*n))^p/(b+2*c*Cot[d+e*x]^n)^(2*p)*Int[Cot[d+e*x]^m*(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

2:  ∫((Tan[d+e x])^m) (((a+b (((f Tan[d+e x]))^n)+c (((f Tan[d+e x]))^(2n))))^p)dx  when  (b^2)-4a c≠0

Derivation: Integration by substitution

Basis: ((Tan[d+e x])^m) F[f Tan[d+e x]]==(f/e) Subst[((((x/f)))^m) ((F[x])/((f^2)+(x^2))),x,f Tan[d+e x]](∂_x)(f Tan[d+e x])

Rule: If  (b^2)-4a c≠0, then

∫((Tan[d+e x])^m) (((a+b (((f Tan[d+e x]))^n)+c (((f Tan[d+e x]))^(2n))))^p)dx  ⟶  (f/e)Subst[∫((((x/f)))^m) ((((a+b (x^n)+c (x^(2n))))^p)/((f^2)+(x^2)))dx,x,f Tan[d+e x]]

Program code:

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*(f_.*tan[d_.+e_.*x_])^n_.+c_.*(f_.*tan[d_.+e_.*x_])^n2_.)^p_,x_Symbol] :=
  f/e*Subst[Int[(x/f)^m*(a+b*x^n+c*x^(2*n))^p/(f^2+x^2),x],x,f*Tan[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,m,n,p},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*(f_.*cot[d_.+e_.*x_])^n_.+c_.*(f_.*cot[d_.+e_.*x_])^n2_.)^p_,x_Symbol] :=
  -f/e*Subst[Int[(x/f)^m*(a+b*x^n+c*x^(2*n))^p/(f^2+x^2),x],x,f*Cot[d+e*x]] /;
FreeQ[{a,b,c,d,e,f,m,n,p},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0]

5.  ∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx

1.  ∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0

1:  ∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ p∈ℤ, then

∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  (1/((4^p)(c^p)))∫((Cot[d+e x])^m)(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[Cot[d+e*x]^m*(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_.,x_Symbol] :=
  1/(4^p*c^p)*Int[Tan[d+e*x]^m*(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && IntegerQ[p]

2:  ∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c==0 ∧ p∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^p)/(((b+2 c F[x]))^(2p)))==0

Rule: If  (b^2)-4a c==0 ∧ p∉ℤ, then

∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  ((((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)/(((b+2 c ((Tan[d+e x])^n)))^(2p)))∫((Cot[d+e x])^m)(((b+2c ((Tan[d+e x])^n)))^(2p))dx

Program code:

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_.+c_.*tan[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Tan[d+e*x]^n+c*Tan[d+e*x]^(2*n))^p/(b+2*c*Tan[d+e*x]^n)^(2*p)*Int[Cot[d+e*x]^m*(b+2*c*Tan[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_.+c_.*cot[d_.+e_.*x_]^n2_.)^p_,x_Symbol] :=
  (a+b*Cot[d+e*x]^n+c*Cot[d+e*x]^(2*n))^p/(b+2*c*Cot[d+e*x]^n)^(2*p)*Int[Tan[d+e*x]^m*(b+2*c*Cot[d+e*x]^n)^(2*p),x] /;
FreeQ[{a,b,c,d,e,m,n,p},x] && EqQ[n2,2*n] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[p]]

2:  ∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  when  (b^2)-4a c≠0 ∧ (n/2)∈ℤ

Derivation: Integration by substitution

Basis: ((Tan[z])^2)==(1/((Cot[z])^2))

Basis: ((Cot[d+e x])^m)F[((Tan[d+e x])^2)]==-(1/e)Subst[(((x^m)F[(1/(x^2))])/(1+(x^2))),x,Cot[d+e x]](∂_x)Cot[d+e x]

Rule: If  (b^2)-4a c≠0 ∧ (n/2)∈ℤ, then

∫((Cot[d+e x])^m)(((a+b ((Tan[d+e x])^n)+c ((Tan[d+e x])^(2n))))^p)dx  ⟶  -(1/e)Subst[∫(((x^(m-2n p))(((c+b (x^n)+a (x^(2 n))))^p))/(1+(x^2)))dx,x,Cot[d+e x]]

Program code:

Int[cot[d_.+e_.*x_]^m_.*(a_.+b_.*tan[d_.+e_.*x_]^n_+c_.*tan[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Cot[d+e*x],x]},
  g/e*Subst[Int[(g*x)^(m-2*n*p)*(c+b*(g*x)^n+a*(g*x)^(2*n))^p/(1+g^2*x^2),x],x,Cot[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e,m,p},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0] && IntegerQ[n/2]

Int[tan[d_.+e_.*x_]^m_.*(a_.+b_.*cot[d_.+e_.*x_]^n_+c_.*cot[d_.+e_.*x_]^n2_)^p_.,x_Symbol] :=
  Module[{g=FreeFactors[Tan[d+e*x],x]},
  -g/e*Subst[Int[(g*x)^(m-2*n*p)*(c+b*(g*x)^n+a*(g*x)^(2*n))^p/(1+g^2*x^2),x],x,Tan[d+e*x]/g]] /;
FreeQ[{a,b,c,d,e,m,p},x] && EqQ[n2,2*n] && NeQ[b^2-4*a*c,0] && IntegerQ[n/2]

6.  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx

1.  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  when  (b^2)-4a c==0

1:  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  when  (b^2)-4a c==0 ∧ n∈ℤ

Derivation: Algebraic simplification

Basis: If  (b^2)-4a c==0, then a+b z+c (z^2)==((((b+2 c z))^2)/(4 c))

Rule: If  (b^2)-4a c==0 ∧ n∈ℤ, then

∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  ⟶  (1/((4^n)(c^n)))∫(A+B Tan[d+e x])(((b+2c Tan[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*tan[d_.+e_.*x_])*(a_+b_.*tan[d_.+e_.*x_]+c_.*tan[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Tan[d+e*x])*(b+2*c*Tan[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && IntegerQ[n]

Int[(A_+B_.*cot[d_.+e_.*x_])*(a_+b_.*cot[d_.+e_.*x_]+c_.*cot[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  1/(4^n*c^n)*Int[(A+B*Cot[d+e*x])*(b+2*c*Cot[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && IntegerQ[n]

2:  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  when  (b^2)-4a c==0 ∧ n∉ℤ

Derivation: Piecewise constant extraction

Basis: If  (b^2)-4a c==0, then (∂_x)((((a+b F[x]+c ((F[x])^2)))^n)/(((b+2 c F[x]))^(2n)))==0

Rule: If  (b^2)-4a c==0 ∧ n∉ℤ, then

∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  ⟶  ((((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)/(((b+2 c Tan[d+e x]))^(2n)))∫(A+B Tan[d+e x])(((b+2c Tan[d+e x]))^(2n))dx

Program code:

Int[(A_+B_.*tan[d_.+e_.*x_])*(a_+b_.*tan[d_.+e_.*x_]+c_.*tan[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Tan[d+e*x]+c*Tan[d+e*x]^2)^n/(b+2*c*Tan[d+e*x])^(2*n)*Int[(A+B*Tan[d+e*x])*(b+2*c*Tan[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[n]]

Int[(A_+B_.*cot[d_.+e_.*x_])*(a_+b_.*cot[d_.+e_.*x_]+c_.*cot[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  (a+b*Cot[d+e*x]+c*Cot[d+e*x]^2)^n/(b+2*c*Cot[d+e*x])^(2*n)*Int[(A+B*Cot[d+e*x])*(b+2*c*Cot[d+e*x])^(2*n),x] /;
FreeQ[{a,b,c,d,e,A,B},x] && EqQ[b^2-4*a*c,0] && Not[IntegerQ[n]]

2.  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  when  (b^2)-4a c≠0

1:  ∫((A+B Tan[d+e x])/(a+b Tan[d+e x]+c ((Tan[d+e x])^2)))dx  when  (b^2)-4 a c≠0

Derivation: Algebraic expansion

Basis: If  q=(Sqrt[(b^2)-4 a c]), then ((A+B z)/(a+b z+c (z^2)))==(B+((b B-2 A c)/q))(1/(b+q+2 c z))+(B-((b B-2 A c)/q))(1/(b-q+2 c z))

Rule: If  (b^2)-4 a c≠0, let  q=(Sqrt[(b^2)-4 a c]), then

∫((A+B Tan[d+e x])/(a+b Tan[d+e x]+c ((Tan[d+e x])^2)))dx  ⟶  (B+((b B-2 A c)/q))∫(1/(b+q+2 c Tan[d+e x]))dx+(B-((b B-2 A c)/q))∫(1/(b-q+2 c Tan[d+e x]))dx

Program code:

Int[(A_+B_.*tan[d_.+e_.*x_])/(a_.+b_.*tan[d_.+e_.*x_]+c_.*tan[d_.+e_.*x_]^2),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  (B+(b*B-2*A*c)/q)*Int[1/Simp[b+q+2*c*Tan[d+e*x],x],x] + 
  (B-(b*B-2*A*c)/q)*Int[1/Simp[b-q+2*c*Tan[d+e*x],x],x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

Int[(A_+B_.*cot[d_.+e_.*x_])/(a_.+b_.*cot[d_.+e_.*x_]+c_.*cot[d_.+e_.*x_]^2),x_Symbol] :=
  Module[{q=Rt[b^2-4*a*c,2]},
  (B+(b*B-2*A*c)/q)*Int[1/Simp[b+q+2*c*Cot[d+e*x],x],x] + 
  (B-(b*B-2*A*c)/q)*Int[1/Simp[b-q+2*c*Cot[d+e*x],x],x]] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0]

2:  ∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  when  (b^2)-4 a c≠0 ∧ n∈ℤ

Derivation: Algebraic expansion

Rule: If  (b^2)-4 a c≠0 ∧ n∈ℤ

∫(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n)dx  ⟶  ∫ExpandTrig[(A+B Tan[d+e x])(((a+b Tan[d+e x]+c ((Tan[d+e x])^2)))^n),x]dx

Program code:

Int[(A_+B_.*tan[d_.+e_.*x_])*(a_.+b_.*tan[d_.+e_.*x_]+c_.*tan[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*tan[d+e*x])*(a+b*tan[d+e*x]+c*tan[d+e*x]^2)^n,x],x] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0] && IntegerQ[n]

Int[(A_+B_.*cot[d_.+e_.*x_])*(a_.+b_.*cot[d_.+e_.*x_]+c_.*cot[d_.+e_.*x_]^2)^n_,x_Symbol] :=
  Int[ExpandTrig[(A+B*cot[d+e*x])*(a+b*cot[d+e*x]+c*cot[d+e*x]^2)^n,x],x] /;
FreeQ[{a,b,c,d,e,A,B},x] && NeQ[b^2-4*a*c,0] && IntegerQ[n]